package com.leyou.item.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 品牌Mapper
 */
public interface BrandMapper extends BaseMapper<Brand> {
    /**
     * 注意：2个或两个以上的参数记得必须使用@Param主键给参数定义别名
     * @param cids
     * @param id
     */
    void insertCategoryAndBrand(@Param("cids") List<Long> cids, @Param("bid")Long id);


    /**
     * 品牌
     */
    @Select("SELECT b.* FROM tb_brand b,tb_category_brand cb WHERE b.id = cb.brand_id AND cb.category_id = #{categoryId}")
    List<Brand> findBrandsByCid(Long id);

}
